// $Id: array.h 143 2013-06-15 05:21:05Z alan.watson.f $

#ifndef OAXACA_ARRAY_H
#define OAXACA_ARRAY_H

#if __cplusplus
extern "C" {
#endif

#include <stddef.h>

typedef struct {
  size_t nx, ny;
  short **z;
  int alloced;
} array_short_t;

typedef struct {
  size_t nx, ny;
  long **z;
  int alloced;
} array_long_t;

typedef struct {
  size_t nx, ny;
  double **z;
  int alloced;
} array_double_t;

extern array_short_t *alloc_array_short(size_t, size_t);
extern array_long_t *alloc_array_long(size_t, size_t);
extern array_double_t *alloc_array_double(size_t, size_t);

extern array_short_t *wrap_array_short(size_t, size_t, short *, size_t);
extern array_long_t *wrap_array_long(size_t, size_t, long *, size_t);
extern array_double_t *wrap_array_double(size_t, size_t, double *, size_t);

extern void free_array_short(array_short_t *);
extern void free_array_long(array_long_t *);
extern void free_array_double(array_double_t *);

#if __cplusplus
}
#endif

#endif
